package com.wnx.job.modules.pms.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wnx.job.modules.pms.mapper.PmsTagMapper;
import com.wnx.job.modules.pms.model.PmsTag;
import com.wnx.job.modules.pms.service.PmsTagService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangnaixing
 * @since 2021-12-17
 */
@Service
public class PmsTagServiceImpl extends ServiceImpl<PmsTagMapper, PmsTag> implements PmsTagService {
    @Resource
    private PmsTagMapper tagMapper;

    /**
     * 根据职位ID查询标签数量
     * @param postId
     * @return
     */
    @Override
    public long findTagCountByPostId(Long postId) {
        return tagMapper.selectCount(new QueryWrapper<PmsTag>().lambda().eq(PmsTag::getPostId,postId));
    }
    /**
     * 根据职位ID删除标签
     * @param postId
     */
    @Override
    public void deleteByPostId(Long postId) {
         tagMapper.delete(new QueryWrapper<PmsTag>().lambda().eq(PmsTag::getPostId,postId));
    }
}
